package com.sky.client;

import com.sky.dto.DishDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.vo.DishVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "sky-service-dish")
public interface DishClient {

    /**
     * 新增菜品
     *
     * @param dishDTO
     * @return
     */
    @PostMapping("/admin/dish")
    Result save(@RequestBody DishDTO dishDTO);

    /**
     * 菜品分页查询
     *
     * @param dishPageQueryDTO
     * @return
     */
    @GetMapping("/admin/dish/page")
    Result<PageResult> page(@RequestParam DishPageQueryDTO dishPageQueryDTO);

    /**
     * 菜品批量删除
     *
     * @param ids
     * @return
     */
    @DeleteMapping("/admin/dish")
    Result delete(@RequestParam List<Long> ids);

    /**
     * 根据id查询菜品
     *
     * @param id
     * @return
     */
    @GetMapping("/admin/dish/{id}")
    Result<DishVO> getById(@PathVariable Long id);

    /**
     * 修改菜品
     *
     * @param dishDTO
     * @return
     */
    @PutMapping("/admin/dish")
    Result update(@RequestBody DishDTO dishDTO);

    /**
     * 根据分类id查询菜品
     *
     * @param categoryId
     * @return
     */
    @GetMapping("/admin/dish/list")
    Result<List<Dish>> list(@RequestParam Long categoryId);

    /**
     * 启用、禁用分类
     *
     * @param status
     * @param id
     * @return
     */
    @PostMapping("/admin/dish/status/{status}")
    Result<String> startOrStop(@PathVariable("status") Integer status, @RequestParam Long id);

    /**
     * 根据分类id查询菜品数量
     *
     * @param categoryId
     * @return
     */
    @GetMapping("/admin/dish/count")
    Integer countByCategoryId(@RequestParam("categoryId") Long categoryId);
}